package com.jetinno.jetinnosystem;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Window;


/**
 * Created by zhangyuncai.
 * Date: 2022/2/15
 */
public class MainActivity extends Activity {
    private static final String TAG = "MainActivity";

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        JetinnoSystemService.startService(this);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setFinishOnTouchOutside(true);
        setContentView(R.layout.activity_main);

        CrashHandler.getInstance().init(getApplication());
        JetinnoSystemService.startService(this);

    }

    @Override
    protected void onResume() {
        super.onResume();
        new Handler(Looper.getMainLooper())
                .postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        //按返回键返回桌面
                        moveTaskToBack(true);
                    }
                },1000);

    }

    /*
    Intent clientService = new Intent();
        clientService.setAction("com.jetinno.jetinnosystemclient.ClientService");
        clientService.setPackage(HbConstant.MAIN_PACKAGE_NAME);
        clientService.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        bindService(clientService, mJetinnoCoffeeConnection, BIND_AUTO_CREATE);
     */

    @Override
    protected void onDestroy() {
        super.onDestroy();
        JetinnoSystemService.stopService(this);
    }
}
